package com.heima.wemedia.controller.v1;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmNewsStatisticsDto;
import com.heima.wemedia.service.NewsStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("api/v1/statistics")
public class NewsStatisticsController {
    @Autowired
    private NewsStatisticsService newsStatisticsService;

    /**
     * 查看文章统计
     * @param beginDate,endDate
     * @return
     */
    @GetMapping("newsDimension")
    public ResponseResult getNewsDimension(String beginDate,String endDate){
        return newsStatisticsService.getNewsDimension(beginDate,endDate);
    }

    /**
     * 分页展示文章列表
     * @param dto
     * @return
     */
    @GetMapping("newsPage")
    public PageResponseResult getNewsPage(WmNewsStatisticsDto dto){
        return newsStatisticsService.getNewsPage(dto);
    }
}
